package com.mingxingyi.applet.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mingxingyi.applet.constant.UserLoginConstant;
import com.mingxingyi.applet.mapper.StaticResourceAllocationMapper;
import com.mingxingyi.applet.pojo.dto.StaticResourceAllocationDto;
import com.mingxingyi.applet.pojo.entity.StaticResourceAllocation;
import com.mingxingyi.applet.pojo.vo.StaticResourceAllocationVo;
import com.mingxingyi.applet.service.StaticResourceAllocationService;
import com.mingxingyi.base.pojo.RequestDTO;
import com.mingxingyi.base.pojo.ResultVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class StaticResourceAllocationServiceImpl implements StaticResourceAllocationService {

    @Resource
    private StaticResourceAllocationMapper resourceAllocationMapper;

    @Override
    public ResultVO<? extends StaticResourceAllocation> getResource(RequestDTO<StaticResourceAllocationDto> dto) {

        LambdaQueryWrapper<StaticResourceAllocation> queryWrapper=new LambdaQueryWrapper<>();
        queryWrapper.eq(StaticResourceAllocation::getStatus, UserLoginConstant.DEFAULT_ZERO);

        List<StaticResourceAllocation> staticResourceAllocations = resourceAllocationMapper.selectList(queryWrapper);
        return ResultVO.success(staticResourceAllocations);
    }
}
